package tsj.ai.alibaba.data.analysis.service.llm;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.stereotype.Component;

/**
 * @author taoshujian
 * @version 1.0
 * @since 2025-11-13 14:09:32
 */
@Slf4j
@Component
public class BlockLlmService  implements LlmService {

    private ChatClient chatClient;

    public BlockLlmService(ChatClient.Builder builder) {
        this.chatClient = builder.build();
    }

    public String chat(String input) {
        log.info("=======================开始调用大模型=======================");
        String output = this.chatClient.prompt()
                .user(input)
                .call()
                .content();

        log.info("用户提问：{} \n 输出：{}", input,output);
        log.info("=======================结束调用大模型=======================");
        return output;
    }

    @Override
    public String call(String system, String user) {
        return "";
    }

    @Override
    public String callSystem(String system) {
        return "";
    }

    @Override
    public String callUser(String user) {
        String output = this.chatClient.prompt()
                .user(user)
                .call()
                .content();
        log.info("=======================开始调用大模型=======================");
        log.info("用户提问：{} \n 输出：{}", user,output);
        log.info("=======================结束调用大模型=======================");
        return output;
    }
}
